<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    // 1 switch   1 2 3 4  case 
    //  while  死循环 循环体里面有if else 判断
    // 开始准备个余额     对面条件里面执行对应的操作
    let money = 10000
    while (true) {
      let cz = prompt(`
            请输入您的操作：
            1:存钱
            2:取钱
            3:查看余额
            4:退出 
      `)
      switch (cz) {
        case '1':
          let cun = +prompt('请输入您存的数额')
          money = money + cun
          break
        case '2':
          let qun = +prompt('请输入您取的数额')

          money = money - qun
          break
        case '3':
          alert(`您的余额还有${money}`)
          break
        case '4':
          break
        default:
          break
      }
      if (cz === '4') {
        alert('退出成功')
        break
      }
    }
  </script>
</body>

</html>